#ifndef _MOE_MUTATOR
#define _MOE_MUTATOR

#include "engine/Properties.hh"
#include "engine/Solution.hh"

/**Mutation operator
  *this operator takes a solution an change it producing a mutation
  */
class Mutation {

protected:

    double probability;

public:

    Mutation(double probability) {
        this->probability = probability;
    }

    virtual ~Mutation() {}

    void apply(Solution *solution) {

        ArrayList<Restriction> *restrictions = Solution::getRestrictions();

        mutate(solution);
        if (restrictions != NULL)
            for (int i = 0; i < restrictions->length(); i++)
                restrictions->get(i)->apply(solution);

    }

protected:

    virtual void mutate(Solution *solution) = 0;
};

#endif
